import unittest

from server.framework.core.logger import logger
from server.framework.utils.kubernetes.kubernetes_client import KubernetesClient


class KubernetesClientTest(unittest.TestCase):

    def setUp(self) -> None:
        super().setUp()

    def test_list_storage_classes(self):
        kubernetes_manager = KubernetesClient()
        result = kubernetes_manager.list_storage_classes()
        logger.info(result)

    def test_list_node_info(self):
        kubernetes_manager = KubernetesClient()
        node_info = kubernetes_manager.list_node_info()
        logger.info(node_info)

    def test_list_pods_by_node(self):
        kubernetes_manager = KubernetesClient()
        nodes = kubernetes_manager.list_node_info()
        for node in nodes:
            pods = kubernetes_manager.list_pods_by_node(node)
            logger.info(pods)

    def test_list_node_ports(self):
        kubernetes_manager = KubernetesClient()
        ports = kubernetes_manager.list_node_ports()
        logger.info(ports)
    #
    # def test_apply_argo_job(self):
    #     self.kubernetes_manager.run_build_image_workflow('./argo_simple_job.yml', 'sample', {})


if __name__ == '__main__':
    unittest.main()
